package com.agh.portal.domain.util;

import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

import org.joda.time.format.DateTimeFormat;

public class CustomDateUtils {
	
	public static String patternForStyle(String style, Locale locale){
		return DateTimeFormat.patternForStyle(style,locale);
	}
	
	public static Date getBirthDate(int year, int month, int day){
		Calendar cal = Calendar.getInstance();
		month--;
		cal.set(year, month, day);
		return cal.getTime();
	}
	
	public static Date getRandomDate(){
		Calendar cal = Calendar.getInstance();
		int year = MathUtils.randomBetween(2011, 2013);
		int month = MathUtils.randomBetween(0, 11);
		int day = MathUtils.randomBetween(1, 28);
		int minute = MathUtils.randomBetween(1, 59);
		int hour = MathUtils.randomBetween(1, 23);
		int second = MathUtils.randomBetween(1, 59);
		cal.set(year, month, day);
		cal.add(Calendar.HOUR, hour);
		cal.add(Calendar.MINUTE, minute);
		cal.add(Calendar.SECOND, second);
		return cal.getTime();
	}

}
